<?php

namespace app\erp\validate;

use think\Validate;

class Goodsrule extends Validate
{
    protected $rule = [
        'goods_sku' => 'require|unique:goods,goods_sku^partner_id^site_id',
        'goods_model' => 'require|unique:goods,goods_model^partner_id^site_id',
        'weight' => 'require|number'
    ];
    protected $message = [
        'goods_sku.require' => '商品编号不能为空',
        'goods_sku.unique' => '商品编号已存在',
        'goods_model.require' => '商品型号不能为空',
        'goods_model.unique' => '商品型号已存在',
        'weight.require' => '重量必须填写，默认为0',
        'weight.number' => '重量只能是数字'
    ];
    protected $scene = [
        'checkmodel' => [
            'goods_model' => 'require|unique:goods,goods_model^partner_id^site_id^category_sign3'
        ]
    ];
}